package
{
	import flash.events.Event;
	import flash.events.ProgressEvent;
	import flash.filesystem.File;
	import flash.filesystem.FileMode;
	import flash.filesystem.FileStream;
	import flash.utils.ByteArray;
	
	public class TestPlayer extends BasePlayer
	{
		private var mFile:File;
		private var fileStream:FileStream;
		
		private var offest:uint;
		public function TestPlayer()
		{
			super("sintel.mp4");
			
			//写到桌面中test.mp4中
			var file:File = File.desktopDirectory.resolvePath("test.mp4");
			fileStream = new FileStream();
			fileStream.open(file, FileMode.WRITE);
		}
		
		override protected function onComplete(event:Event):void{
			fileStream.close();
			trace("onComplete");	
		}
		
		override protected function onProgress(event:ProgressEvent):void{
			trace("onProgress", event, mURLStream.bytesAvailable);	
			var byte:ByteArray = new ByteArray();
			mURLStream.readBytes(byte);
			byte.position = 0;
			
			fileStream.writeBytes(byte);
		}
	}
}